import { createRouter, createWebHistory } from 'vue-router'
import { createdRouterConfig } from '@/utils/index'


// 默认显示在左侧的菜单
export const defaultMenu = [
  {
    menu_id: -1,
    menu_text: "首页",
    menu_icon: "House",
    menu_href: "/admin/home",
    menu_type: 0,
    menu_father_id: 0,
    menu_status: 0,
    children: [],
  }
]

export const config = [
  {
    path: '/admin',
    name: 'admin',
    component: () => import('../views/admin/_layout.vue'),
    children: [
      {
        path: 'home',
        name: 'admin_Home',
        component: () => import('../views/admin/Home.vue'),
        meta: {
          title: '首页',
        }
      }
    ]
  },
  {
    path: '/admin/account',
    name: 'adminAccount',
    component: () => import('../views/admin/User/Account.vue'),
    meta: {
     
    }
  },

  // ---------------------------------------
  
  {
    path: '/',
    name: 'app',
    component: () => import('../views/app/_layout.vue'),
    children: [
      {
        path: 'home',
        name: 'appHome',
        component: () => import('../views/app/Home.vue'),
        meta: {
          isSider: true
        }
      },
      {
        path: 'article',
        name: 'appArticle',
        component: () => import('../views/app/Article.vue'),
        meta: {
          isSider: true
        }
      },
      {
        path: 'classification',
        name: 'appClassification',
        component: () => import('../views/app/Classification.vue'),
        meta: {
          isSider: true
        }
      },
      {
        path: 'tags',
        name: 'appTags',
        component: () => import('../views/app/Tags.vue'),
        meta: {
          isSider: true
        }
      },
      {
        path: 'search',
        name: 'appSearch',
        component: () => import('../views/app/Search.vue'),
        meta: {
          isSider: false
        }
      },
      {
        path: 'about',
        name: 'app_About',
        component: () => import('../views/app/About.vue'),
        meta: {
          isSider: false
        }
      },
      {
        path: 'info',
        name: 'app_info',
        component: () => import('../views/app/Info.vue'),
        meta: {
          isSider: false
        }
      }
    ]
  },
  {
    path: '/user',
    name: 'appuser',
    component: () => import('../views/app/User.vue'),
    meta: {
      isSider: true
    }
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: config
})

createdRouterConfig(router)

export const { push, replace, back, go } = router

export default router


